﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Web;

/// <summary>
/// Summary description for ProPosition
/// </summary>
public class ProPosition
{
	public ProPosition()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public DataSet LoadPos()
    {
        DataSet ds = new DataSet();
        ConnectDB db = new ConnectDB();
        ds = db.getListPosition();
        return ds;
    }

    public Boolean SavePos(Position pos)
    {
        Boolean bResult = false;
        ConnectDB db = new ConnectDB();
        bResult = db.savePos(pos);

        return bResult;
    }

    //true: exist; false: not exist
    public Boolean CheckPosExist(String nameofpos)
    {
        Boolean result = false;
        ConnectDB db = new ConnectDB();
        DataSet ds = new DataSet();
        ds = db.checkExistPost(nameofpos);
        if (ds.Tables[0].Rows.Count == 0)
            result = false;
        else
            result = true;
        return result;
    }

    public Boolean DeletePos(Position pos)
    {
        ConnectDB db = new ConnectDB();
        Boolean bResult = db.deletePost(pos);
        return bResult;
    }

    public Boolean UpdatePos(Position pos)
    {
        ConnectDB db = new ConnectDB();
        Boolean bResult = db.editPost(pos);
        return bResult;
    }
}
